package pers.qianyu.config;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.*;
import org.springframework.context.annotation.*;

/**
 * MyBatis Plus 配置类
 *
 * @author mizzle rain
 * @date 2020-10-12 10:42
 */
@Configuration
public class MyBatisPlusConfig {
    /**
     * 分页配置
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        // 数据库类型错误
        paginationInterceptor.setDbType(DbType.HSQL);
        return paginationInterceptor;
    }

    /**
     * 乐观锁配置
     */
    @Bean
    public OptimisticLockerInterceptor optimisticLockerInterceptor() {
        return new OptimisticLockerInterceptor();
    }
}
